import type { RequestHandler } from "@sveltejs/kit"; import config from "$lib/config"; export const get: RequestHandler = async({params, locals}) => { const scopeId = parseInt(params.scope); const db = await config.database(); const scope = await db.withUser(locals.user.id).scopes().find(scopeId) if (scope === null) { return { status: 404, headers: { "Content-Type": "application/json" }, body: JSON.stringify({ message: "Scope not found", }), } } return { status: 200, headers: { "Content-Type": "application/json" }, body: JSON.stringify({ scope }), } }